export default defineEventHandler(async (event) => {
  // 模拟仪表板数据
  const dashboardData = {
    // 概览统计
    overview: {
      totalUsers: 1250,
      totalOrders: 3420,
      totalRevenue: 1256800,
      totalProducts: 156,
      newUsers: 89,
      newOrders: 156,
      revenueGrowth: 12.5,
      userGrowth: 8.3
    },
    
    // 销售统计
    sales: {
      today: 15600,
      week: 89000,
      month: 356000,
      year: 1256800,
      growth: {
        today: 5.2,
        week: 8.7,
        month: 12.3,
        year: 15.8
      }
    },
    
    // 用户统计
    users: {
      total: 1250,
      active: 890,
      inactive: 360,
      newThisMonth: 156,
      growth: 8.3
    },
    
    // 订单统计
    orders: {
      total: 3420,
      pending: 45,
      processing: 23,
      shipped: 156,
      delivered: 3156,
      cancelled: 40,
      growth: 12.5
    },
    
    // 热门商品
    topProducts: [
      {
        id: 1,
        name: 'MacBook Pro 14英寸',
        sales: 89,
        revenue: 1335111,
        growth: 15.2
      },
      {
        id: 2,
        name: 'iPhone 15 Pro',
        sales: 156,
        revenue: 1247844,
        growth: 8.7
      },
      {
        id: 3,
        name: '机械键盘 Cherry MX',
        sales: 234,
        revenue: 140406,
        growth: 12.3
      },
      {
        id: 4,
        name: '4K显示器 27英寸',
        sales: 45,
        revenue: 112455,
        growth: 6.8
      },
      {
        id: 5,
        name: '无线蓝牙耳机',
        sales: 189,
        revenue: 56511,
        growth: 18.9
      }
    ],
    
    // 销售趋势（最近30天）
    salesTrend: [
      { date: '2024-02-15', sales: 12000, orders: 45 },
      { date: '2024-02-16', sales: 13500, orders: 52 },
      { date: '2024-02-17', sales: 9800, orders: 38 },
      { date: '2024-02-18', sales: 15600, orders: 61 },
      { date: '2024-02-19', sales: 14200, orders: 55 },
      { date: '2024-02-20', sales: 16800, orders: 67 },
      { date: '2024-02-21', sales: 18900, orders: 72 },
      { date: '2024-02-22', sales: 17500, orders: 68 },
      { date: '2024-02-23', sales: 19800, orders: 78 },
      { date: '2024-02-24', sales: 22100, orders: 85 },
      { date: '2024-02-25', sales: 20300, orders: 79 },
      { date: '2024-02-26', sales: 18700, orders: 73 },
      { date: '2024-02-27', sales: 16500, orders: 64 },
      { date: '2024-02-28', sales: 14200, orders: 55 },
      { date: '2024-02-29', sales: 15600, orders: 61 },
      { date: '2024-03-01', sales: 17800, orders: 69 },
      { date: '2024-03-02', sales: 19500, orders: 76 },
      { date: '2024-03-03', sales: 21200, orders: 82 },
      { date: '2024-03-04', sales: 19800, orders: 77 },
      { date: '2024-03-05', sales: 18400, orders: 71 },
      { date: '2024-03-06', sales: 16700, orders: 65 },
      { date: '2024-03-07', sales: 14500, orders: 56 },
      { date: '2024-03-08', sales: 13200, orders: 51 },
      { date: '2024-03-09', sales: 15600, orders: 60 },
      { date: '2024-03-10', sales: 17800, orders: 68 },
      { date: '2024-03-11', sales: 19500, orders: 75 },
      { date: '2024-03-12', sales: 20800, orders: 80 },
      { date: '2024-03-13', sales: 19200, orders: 74 },
      { date: '2024-03-14', sales: 17600, orders: 68 },
      { date: '2024-03-15', sales: 15600, orders: 61 }
    ],
    
    // 用户增长趋势
    userGrowth: [
      { date: '2024-02-15', users: 1150, newUsers: 12 },
      { date: '2024-02-16', users: 1162, newUsers: 15 },
      { date: '2024-02-17', users: 1177, newUsers: 8 },
      { date: '2024-02-18', users: 1185, newUsers: 18 },
      { date: '2024-02-19', users: 1203, newUsers: 14 },
      { date: '2024-02-20', users: 1217, newUsers: 22 },
      { date: '2024-02-21', users: 1239, newUsers: 19 },
      { date: '2024-02-22', users: 1258, newUsers: 16 },
      { date: '2024-02-23', users: 1274, newUsers: 25 },
      { date: '2024-02-24', users: 1299, newUsers: 21 },
      { date: '2024-02-25', users: 1320, newUsers: 17 },
      { date: '2024-02-26', users: 1337, newUsers: 13 },
      { date: '2024-02-27', users: 1350, newUsers: 11 },
      { date: '2024-02-28', users: 1361, newUsers: 9 },
      { date: '2024-02-29', users: 1370, newUsers: 15 },
      { date: '2024-03-01', users: 1385, newUsers: 20 },
      { date: '2024-03-02', users: 1405, newUsers: 18 },
      { date: '2024-03-03', users: 1423, newUsers: 24 },
      { date: '2024-03-04', users: 1447, newUsers: 19 },
      { date: '2024-03-05', users: 1466, newUsers: 16 },
      { date: '2024-03-06', users: 1482, newUsers: 12 },
      { date: '2024-03-07', users: 1494, newUsers: 10 },
      { date: '2024-03-08', users: 1504, newUsers: 8 },
      { date: '2024-03-09', users: 1512, newUsers: 14 },
      { date: '2024-03-10', users: 1526, newUsers: 17 },
      { date: '2024-03-11', users: 1543, newUsers: 21 },
      { date: '2024-03-12', users: 1564, newUsers: 23 },
      { date: '2024-03-13', users: 1587, newUsers: 19 },
      { date: '2024-03-14', users: 1606, newUsers: 15 },
      { date: '2024-03-15', users: 1621, newUsers: 11 }
    ],
    
    // 商品分类统计
    categoryStats: [
      { category: '电子产品', sales: 156, revenue: 2456800, percentage: 45.2 },
      { category: '电脑配件', sales: 89, revenue: 890000, percentage: 25.8 },
      { category: '音频设备', sales: 67, revenue: 456000, percentage: 18.5 },
      { category: '办公用品', sales: 45, revenue: 234000, percentage: 10.5 }
    ],
    
    // 最近订单
    recentOrders: [
      {
        id: 'ORD-2024-001',
        customer: '张三',
        product: 'MacBook Pro 14英寸',
        amount: 14999,
        status: 'delivered',
        date: '2024-03-15T10:30:00Z'
      },
      {
        id: 'ORD-2024-002',
        customer: '李四',
        product: 'iPhone 15 Pro',
        amount: 7999,
        status: 'shipped',
        date: '2024-03-15T09:15:00Z'
      },
      {
        id: 'ORD-2024-003',
        customer: '王五',
        product: '机械键盘 Cherry MX',
        amount: 599,
        status: 'processing',
        date: '2024-03-15T08:45:00Z'
      },
      {
        id: 'ORD-2024-004',
        customer: '赵六',
        product: '4K显示器 27英寸',
        amount: 2499,
        status: 'pending',
        date: '2024-03-15T08:20:00Z'
      },
      {
        id: 'ORD-2024-005',
        customer: '钱七',
        product: '无线蓝牙耳机',
        amount: 299,
        status: 'delivered',
        date: '2024-03-14T16:30:00Z'
      }
    ]
  }

  // 模拟延迟
  await new Promise(resolve => setTimeout(resolve, 400))

  return {
    code: 200,
    message: '获取仪表板数据成功',
    data: dashboardData
  }
}) 